package com.aerozhonghuan.archive.controller;

import com.aerozhonghuan.archive.service.IncrementalMigrationService;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/incremental-migration")
public class IncrementalMigrationController {

    private final IncrementalMigrationService incrementalMigrationService;

    public IncrementalMigrationController(IncrementalMigrationService incrementalMigrationService) {
        this.incrementalMigrationService = incrementalMigrationService;
    }

    /**
     * 执行增量数据迁移
     *
     * @param batchSize 每批次数据量，默认 10000
     * @return 迁移结果汇总信息
     */
    @PostMapping("/execute")
    public String executeMigration(@RequestParam(value = "batchSize", defaultValue = "10000") int batchSize) {
        return incrementalMigrationService.executeIncrementalMigration(batchSize);
    }

}
